﻿using System;
using System.Linq;
using Microsoft.SharePoint;

namespace SPDeployer.Core
{
    internal class WebManager
    {
        public SPWeb Create(SPSite site, string url, string title, string description, uint lcid, 
            string template, bool uniquePermissions)
        {
            new Uri(url, UriKind.Relative);

            return site.AllWebs.Add(url, title, description, lcid, template, uniquePermissions, false);
        }

        public SPWeb Get(SPSite site, string url)
        {
            return site.AllWebs.SingleOrDefault(w => w.Url == url);
        }
    }
}
